create function binary_coercible(oid, oid) returns bool as begin  if  1 =  2 then return true;
 end if;
 end if;
  if EXISTS(select 1 from pg_catalog.pg_cast where            castsource =  1 and casttarget =  2 and            castmethod = 'b' and castcontext = 'i')  then return true;
 end if;
 end if;
  if  2 = 'pg_catalog.any'::pg_catalog.regtype then return true;
 end if;
 end if;
  if  2 = 'pg_catalog.anyarray'::pg_catalog.regtype then    if EXISTS(select 1 from pg_catalog.pg_type where              oid =  1 and typelem != 0 and typlen = -1)    then return true;
 end if;
 end if;
  end if;
  if  2 = 'pg_catalog.anyrange'::pg_catalog.regtype then    if (select typtype from pg_catalog.pg_type where oid =  1) = 'r'    then return true;
 end if;
 end if;
  end if;
  return false;
end language plpgsql strict stable;
create function explicitly_binary_coercible(oid, oid) returns bool as begin  if  1 =  2 then return true;
 end if;
 end if;
  if EXISTS(select 1 from pg_catalog.pg_cast where            castsource =  1 and casttarget =  2 and            castmethod = 'b')  then return true;
 end if;
 end if;
  if  2 = 'pg_catalog.any'::pg_catalog.regtype then return true;
 end if;
 end if;
  if  2 = 'pg_catalog.anyarray'::pg_catalog.regtype then    if EXISTS(select 1 from pg_catalog.pg_type where              oid =  1 and typelem != 0 and typlen = -1)    then return true;
 end if;
 end if;
  end if;
  if  2 = 'pg_catalog.anyrange'::pg_catalog.regtype then    if (select typtype from pg_catalog.pg_type where oid =  1) = 'r'    then return true;
 end if;
 end if;
  end if;
  return false;
end language plpgsql strict stable;
SELECT p1.oid, p1.pronameFROM pg_proc as p1WHERE p1.prolang = 0 OR p1.prorettype = 0 OR       p1.pronargs < 0 OR       p1.pronargdefaults < 0 OR       p1.pronargdefaults > p1.pronargs OR       array_lower(p1.proargtypes, 1) != 0 OR       array_upper(p1.proargtypes, 1) != p1.pronargs-1 OR       0::oid = ANY (p1.proargtypes) OR       procost <= 0 OR       CASE WHEN proretset THEN prorows <= 0 ELSE prorows != 0 END OR       prokind NOT IN ('f', 'a', 'w', 'p') OR       provolatile NOT IN ('i', 's', 'v') OR       proparallel NOT IN ('s', 'r', 'u');
SELECT p1.oid, p1.pronameFROM pg_proc as p1WHERE prosrc IS NULL OR prosrc = '' OR prosrc = '-';
SELECT p1.oid, p1.pronameFROM pg_proc AS p1WHERE proretset AND prokind != 'f';
SELECT p1.oid, p1.pronameFROM pg_proc AS p1WHERE prosecdefORDER BY 1;
SELECT p1.oid, p1.pronameFROM pg_proc AS p1WHERE (pronargdefaults <> 0) != (proargdefaults IS NOT NULL);
SELECT p1.oid, p1.pronameFROM pg_proc as p1WHERE prolang = 13 AND (probin IS NULL OR probin = '' OR probin = '-');
SELECT p1.oid, p1.pronameFROM pg_proc as p1WHERE prolang != 13 AND probin IS NOT NULL;
SELECT p1.oid, p1.proname, p2.oid, p2.pronameFROM pg_proc AS p1, pg_proc AS p2WHERE p1.oid != p2.oid AND    p1.proname = p2.proname AND    p1.pronargs = p2.pronargs AND    p1.proargtypes = p2.proargtypes;
SELECT p1.oid, p1.proname, p2.oid, p2.pronameFROM pg_proc AS p1, pg_proc AS p2WHERE p1.oid < p2.oid AND    p1.prosrc = p2.prosrc AND    p1.prolang = 12 AND p2.prolang = 12 AND    (p1.prokind != 'a' OR p2.prokind != 'a') AND    (p1.prolang != p2.prolang OR     p1.prokind != p2.prokind OR     p1.prosecdef != p2.prosecdef OR     p1.proleakproof != p2.proleakproof OR     p1.proisstrict != p2.proisstrict OR     p1.proretset != p2.proretset OR     p1.provolatile != p2.provolatile OR     p1.pronargs != p2.pronargs);
SELECT DISTINCT p1.prorettype::regtype, p2.prorettype::regtypeFROM pg_proc AS p1, pg_proc AS p2WHERE p1.oid != p2.oid AND    p1.prosrc = p2.prosrc AND    p1.prolang = 12 AND p2.prolang = 12 AND    p1.prokind != 'a' AND p2.prokind != 'a' AND    p1.prosrc NOT LIKE E'range\\_constructor_' AND    p2.prosrc NOT LIKE E'range\\_constructor_' AND    (p1.prorettype < p2.prorettype)ORDER BY 1, 2;
SELECT DISTINCT p1.proargtypes[0]::regtype, p2.proargtypes[0]::regtypeFROM pg_proc AS p1, pg_proc AS p2WHERE p1.oid != p2.oid AND    p1.prosrc = p2.prosrc AND    p1.prolang = 12 AND p2.prolang = 12 AND    p1.prokind != 'a' AND p2.prokind != 'a' AND    p1.prosrc NOT LIKE E'range\\_constructor_' AND    p2.prosrc NOT LIKE E'range\\_constructor_' AND    (p1.proargtypes[0] < p2.proargtypes[0])ORDER BY 1, 2;
SELECT DISTINCT p1.proargtypes[1]::regtype, p2.proargtypes[1]::regtypeFROM pg_proc AS p1, pg_proc AS p2WHERE p1.oid != p2.oid AND    p1.prosrc = p2.prosrc AND    p1.prolang = 12 AND p2.prolang = 12 AND    p1.prokind != 'a' AND p2.prokind != 'a' AND    p1.prosrc NOT LIKE E'range\\_constructor_' AND    p2.prosrc NOT LIKE E'range\\_constructor_' AND    (p1.proargtypes[1] < p2.proargtypes[1])ORDER BY 1, 2;
SELECT DISTINCT p1.proargtypes[2]::regtype, p2.proargtypes[2]::regtypeFROM pg_proc AS p1, pg_proc AS p2WHERE p1.oid != p2.oid AND    p1.prosrc = p2.prosrc AND    p1.prolang = 12 AND p2.prolang = 12 AND    p1.prokind != 'a' AND p2.prokind != 'a' AND    (p1.proargtypes[2] < p2.proargtypes[2])ORDER BY 1, 2;
SELECT DISTINCT p1.proargtypes[3]::regtype, p2.proargtypes[3]::regtypeFROM pg_proc AS p1, pg_proc AS p2WHERE p1.oid != p2.oid AND    p1.prosrc = p2.prosrc AND    p1.prolang = 12 AND p2.prolang = 12 AND    p1.prokind != 'a' AND p2.prokind != 'a' AND    (p1.proargtypes[3] < p2.proargtypes[3])ORDER BY 1, 2;
SELECT DISTINCT p1.proargtypes[4]::regtype, p2.proargtypes[4]::regtypeFROM pg_proc AS p1, pg_proc AS p2WHERE p1.oid != p2.oid AND    p1.prosrc = p2.prosrc AND    p1.prolang = 12 AND p2.prolang = 12 AND    p1.prokind != 'a' AND p2.prokind != 'a' AND    (p1.proargtypes[4] < p2.proargtypes[4])ORDER BY 1, 2;
SELECT DISTINCT p1.proargtypes[5]::regtype, p2.proargtypes[5]::regtypeFROM pg_proc AS p1, pg_proc AS p2WHERE p1.oid != p2.oid AND    p1.prosrc = p2.prosrc AND    p1.prolang = 12 AND p2.prolang = 12 AND    p1.prokind != 'a' AND p2.prokind != 'a' AND    (p1.proargtypes[5] < p2.proargtypes[5])ORDER BY 1, 2;
SELECT DISTINCT p1.proargtypes[6]::regtype, p2.proargtypes[6]::regtypeFROM pg_proc AS p1, pg_proc AS p2WHERE p1.oid != p2.oid AND    p1.prosrc = p2.prosrc AND    p1.prolang = 12 AND p2.prolang = 12 AND    p1.prokind != 'a' AND p2.prokind != 'a' AND    (p1.proargtypes[6] < p2.proargtypes[6])ORDER BY 1, 2;
SELECT DISTINCT p1.proargtypes[7]::regtype, p2.proargtypes[7]::regtypeFROM pg_proc AS p1, pg_proc AS p2WHERE p1.oid != p2.oid AND    p1.prosrc = p2.prosrc AND    p1.prolang = 12 AND p2.prolang = 12 AND    p1.prokind != 'a' AND p2.prokind != 'a' AND    (p1.proargtypes[7] < p2.proargtypes[7])ORDER BY 1, 2;
SELECT p1.oid, p1.pronameFROM pg_proc as p1WHERE p1.prorettype = 'internal'::regtype AND NOT    'internal'::regtype = ANY (p1.proargtypes);
SELECT p1.oid, p1.pronameFROM pg_proc as p1WHERE p1.prorettype IN    ('anyelement'::regtype, 'anyarray'::regtype, 'anynonarray'::regtype,     'anyenum'::regtype)  AND NOT    ('anyelement'::regtype = ANY (p1.proargtypes) OR     'anyarray'::regtype = ANY (p1.proargtypes) OR     'anynonarray'::regtype = ANY (p1.proargtypes) OR     'anyenum'::regtype = ANY (p1.proargtypes) OR     'anyrange'::regtype = ANY (p1.proargtypes))ORDER BY 2;
SELECT p1.oid, p1.pronameFROM pg_proc as p1WHERE p1.prorettype = 'anyrange'::regtype  AND NOT     'anyrange'::regtype = ANY (p1.proargtypes)ORDER BY 2;
SELECT p1.oid, p1.pronameFROM pg_proc as p1WHERE p1.prorettype IN    ('anycompatible'::regtype, 'anycompatiblearray'::regtype,     'anycompatiblenonarray'::regtype)  AND NOT    ('anycompatible'::regtype = ANY (p1.proargtypes) OR     'anycompatiblearray'::regtype = ANY (p1.proargtypes) OR     'anycompatiblenonarray'::regtype = ANY (p1.proargtypes) OR     'anycompatiblerange'::regtype = ANY (p1.proargtypes))ORDER BY 2;
SELECT p1.oid, p1.pronameFROM pg_proc as p1WHERE p1.prorettype = 'anycompatiblerange'::regtype  AND NOT     'anycompatiblerange'::regtype = ANY (p1.proargtypes)ORDER BY 2;
SELECT p1.oid, p1.pronameFROM pg_proc as p1WHERE 'cstring'::regtype = ANY (p1.proargtypes)    AND NOT EXISTS(SELECT 1 FROM pg_type WHERE typinput = p1.oid)    AND NOT EXISTS(SELECT 1 FROM pg_conversion WHERE conproc = p1.oid)    AND p1.oid != 'shell_in(cstring)'::regprocedureORDER BY 1;
SELECT p1.oid, p1.pronameFROM pg_proc as p1WHERE  p1.prorettype = 'cstring'::regtype    AND NOT EXISTS(SELECT 1 FROM pg_type WHERE typoutput = p1.oid)    AND NOT EXISTS(SELECT 1 FROM pg_type WHERE typmodout = p1.oid)    AND p1.oid != 'shell_out(void)'::regprocedureORDER BY 1;
SELECT p1.oid, p1.pronameFROM pg_proc as p1WHERE proallargtypes IS NOT NULL AND    array_length(proallargtypes,1) < array_length(proargtypes,1);
SELECT p1.oid, p1.pronameFROM pg_proc as p1WHERE proargmodes IS NOT NULL AND    array_length(proargmodes,1) < array_length(proargtypes,1);
SELECT p1.oid, p1.pronameFROM pg_proc as p1WHERE proargnames IS NOT NULL AND    array_length(proargnames,1) < array_length(proargtypes,1);
SELECT p1.oid, p1.pronameFROM pg_proc as p1WHERE proallargtypes IS NOT NULL AND proargmodes IS NOT NULL AND    array_length(proallargtypes,1) <> array_length(proargmodes,1);
SELECT p1.oid, p1.pronameFROM pg_proc as p1WHERE proallargtypes IS NOT NULL AND proargnames IS NOT NULL AND    array_length(proallargtypes,1) <> array_length(proargnames,1);
SELECT p1.oid, p1.pronameFROM pg_proc as p1WHERE proargmodes IS NOT NULL AND proargnames IS NOT NULL AND    array_length(proargmodes,1) <> array_length(proargnames,1);
SELECT p1.oid, p1.proname, p1.proargtypes, p1.proallargtypes, p1.proargmodesFROM pg_proc as p1WHERE proallargtypes IS NOT NULL AND  ARRAY(SELECT unnest(proargtypes)) <>  ARRAY(SELECT proallargtypes[i]        FROM generate_series(1, array_length(proallargtypes, 1)) g(i)        WHERE proargmodes IS NULL OR proargmodes[i] IN ('i', 'b', 'v'));
SELECT p1.oid, p1.proname, p2.oid, p2.pronameFROM pg_proc AS p1, pg_proc AS p2WHERE p2.oid = p1.prosupport AND    (p2.prorettype != 'internal'::regtype OR p2.proretset OR p2.pronargs != 1     OR p2.proargtypes[0] != 'internal'::regtype);
SELECT p1.oid, p1.pronameFROM pg_proc as p1 LEFT JOIN pg_description as d     ON p1.tableoid = d.classoid and p1.oid = d.objoid and d.objsubid = 0WHERE d.classoid IS NULL AND p1.oid <= 9999;
\a\tSELECT p1.oid::regprocedureFROM pg_proc p1 JOIN pg_namespace pn     ON pronamespace = pn.oidWHERE nspname = 'pg_catalog' AND proleakproofORDER BY 1;
\a\tselect proname, oid from pg_catalog.pg_procwhere proname in (  'lo_open',  'lo_close',  'lo_creat',  'lo_create',  'lo_unlink',  'lo_lseek',  'lo_lseek64',  'lo_tell',  'lo_tell64',  'lo_truncate',  'lo_truncate64',  'loread',  'lowrite')and pronamespace = (select oid from pg_catalog.pg_namespace                    where nspname = 'pg_catalog')order by 1;
SELECT p1.oid, p1.pronameFROM pg_proc AS p1WHERE provolatile = 'i' AND proparallel = 'u';
SELECT *FROM pg_cast cWHERE castsource = 0 OR casttarget = 0 OR castcontext NOT IN ('e', 'a', 'i')    OR castmethod NOT IN ('f', 'b' ,'i');
SELECT *FROM pg_cast cWHERE (castmethod = 'f' AND castfunc = 0)   OR (castmethod IN ('b', 'i') AND castfunc <> 0);
SELECT *FROM pg_cast cWHERE castsource = casttarget AND castfunc = 0;
SELECT c.*FROM pg_cast c, pg_proc pWHERE c.castfunc = p.oid AND p.pronargs < 2 AND castsource = casttarget;
SELECT c.*FROM pg_cast c, pg_proc pWHERE c.castfunc = p.oid AND    (p.pronargs < 1 OR p.pronargs > 3     OR NOT (binary_coercible(c.castsource, p.proargtypes[0])             OR (c.castsource = 'character'::regtype AND                 p.proargtypes[0] = 'text'::regtype))     OR NOT binary_coercible(p.prorettype, c.casttarget));
SELECT c.*FROM pg_cast c, pg_proc pWHERE c.castfunc = p.oid AND    ((p.pronargs > 1 AND p.proargtypes[1] != 'int4'::regtype) OR     (p.pronargs > 2 AND p.proargtypes[2] != 'bool'::regtype));
SELECT castsource::regtype, casttarget::regtype, castfunc, castcontextFROM pg_cast cWHERE c.castmethod = 'b' AND    NOT EXISTS (SELECT 1 FROM pg_cast k                WHERE k.castmethod = 'b' AND                    k.castsource = c.casttarget AND                    k.casttarget = c.castsource);
SELECT p1.oid, p1.connameFROM pg_conversion as p1WHERE p1.conproc = 0 OR    pg_encoding_to_char(conforencoding) = '' OR    pg_encoding_to_char(contoencoding) = '';
SELECT p.oid, p.proname, c.oid, c.connameFROM pg_proc p, pg_conversion cWHERE p.oid = c.conproc AND    (p.prorettype != 'void'::regtype OR p.proretset OR     p.pronargs != 5 OR     p.proargtypes[0] != 'int4'::regtype OR     p.proargtypes[1] != 'int4'::regtype OR     p.proargtypes[2] != 'cstring'::regtype OR     p.proargtypes[3] != 'internal'::regtype OR     p.proargtypes[4] != 'int4'::regtype);
SELECT p1.oid, p1.connameFROM pg_conversion as p1WHERE condefault AND    convert('ABC'::bytea, pg_encoding_to_char(conforencoding),            pg_encoding_to_char(contoencoding)) != 'ABC';
SELECT p1.oid, p1.oprnameFROM pg_operator as p1WHERE (p1.oprkind != 'b' AND p1.oprkind != 'l' AND p1.oprkind != 'r') OR    p1.oprresult = 0 OR p1.oprcode = 0;
SELECT p1.oid, p1.oprnameFROM pg_operator as p1WHERE (p1.oprleft = 0 and p1.oprkind != 'l') OR    (p1.oprleft != 0 and p1.oprkind = 'l') OR    (p1.oprright = 0 and p1.oprkind != 'r') OR    (p1.oprright != 0 and p1.oprkind = 'r');
SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcodeFROM pg_operator AS p1, pg_operator AS p2WHERE p1.oid != p2.oid AND    p1.oprname = p2.oprname AND    p1.oprkind = p2.oprkind AND    p1.oprleft = p2.oprleft AND    p1.oprright = p2.oprright;
SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcodeFROM pg_operator AS p1, pg_operator AS p2WHERE p1.oprcom = p2.oid AND    (p1.oprkind != 'b' OR     p1.oprleft != p2.oprright OR     p1.oprright != p2.oprleft OR     p1.oprresult != p2.oprresult OR     p1.oid != p2.oprcom);
SELECT p1.oid, p1.oprcode, p2.oid, p2.oprcodeFROM pg_operator AS p1, pg_operator AS p2WHERE p1.oprnegate = p2.oid AND    (p1.oprkind != p2.oprkind OR     p1.oprleft != p2.oprleft OR     p1.oprright != p2.oprright OR     p1.oprresult != 'bool'::regtype OR     p2.oprresult != 'bool'::regtype OR     p1.oid != p2.oprnegate OR     p1.oid = p2.oid);
SELECT DISTINCT o1.oprname AS op1, o2.oprname AS op2FROM pg_operator o1, pg_operator o2WHERE o1.oprcom = o2.oid AND o1.oprname <= o2.oprnameORDER BY 1, 2;
SELECT DISTINCT o1.oprname AS op1, o2.oprname AS op2FROM pg_operator o1, pg_operator o2WHERE o1.oprnegate = o2.oid AND o1.oprname <= o2.oprnameORDER BY 1, 2;
SELECT p1.oid, p1.oprname FROM pg_operator AS p1WHERE (p1.oprcanmerge OR p1.oprcanhash) AND NOT    (p1.oprkind = 'b' AND p1.oprresult = 'bool'::regtype AND p1.oprcom != 0);
SELECT p1.oid, p1.oprname, p2.oid, p2.oprnameFROM pg_operator AS p1, pg_operator AS p2WHERE p1.oprcom = p2.oid AND    (p1.oprcanmerge != p2.oprcanmerge OR     p1.oprcanhash != p2.oprcanhash);
SELECT p1.oid, p1.oprnameFROM pg_operator AS p1WHERE p1.oprcanmerge AND NOT EXISTS  (SELECT 1 FROM pg_amop   WHERE amopmethod = (SELECT oid FROM pg_am WHERE amname = 'btree') AND         amopopr = p1.oid AND amopstrategy = 3);
SELECT p1.oid, p1.oprname, p.amopfamilyFROM pg_operator AS p1, pg_amop pWHERE amopopr = p1.oid  AND amopmethod = (SELECT oid FROM pg_am WHERE amname = 'btree')  AND amopstrategy = 3  AND NOT p1.oprcanmerge;
SELECT p1.oid, p1.oprnameFROM pg_operator AS p1WHERE p1.oprcanhash AND NOT EXISTS  (SELECT 1 FROM pg_amop   WHERE amopmethod = (SELECT oid FROM pg_am WHERE amname = 'hash') AND         amopopr = p1.oid AND amopstrategy = 1);
SELECT p1.oid, p1.oprname, p.amopfamilyFROM pg_operator AS p1, pg_amop pWHERE amopopr = p1.oid  AND amopmethod = (SELECT oid FROM pg_am WHERE amname = 'hash')  AND NOT p1.oprcanhash;
SELECT p1.oid, p1.oprname, p2.oid, p2.pronameFROM pg_operator AS p1, pg_proc AS p2WHERE p1.oprcode = p2.oid AND    p1.oprkind = 'b' AND    (p2.pronargs != 2     OR NOT binary_coercible(p2.prorettype, p1.oprresult)     OR NOT binary_coercible(p1.oprleft, p2.proargtypes[0])     OR NOT binary_coercible(p1.oprright, p2.proargtypes[1]));
SELECT p1.oid, p1.oprname, p2.oid, p2.pronameFROM pg_operator AS p1, pg_proc AS p2WHERE p1.oprcode = p2.oid AND    p1.oprkind = 'l' AND    (p2.pronargs != 1     OR NOT binary_coercible(p2.prorettype, p1.oprresult)     OR NOT binary_coercible(p1.oprright, p2.proargtypes[0])     OR p1.oprleft != 0);
SELECT p1.oid, p1.oprname, p2.oid, p2.pronameFROM pg_operator AS p1, pg_proc AS p2WHERE p1.oprcode = p2.oid AND    p1.oprkind = 'r' AND    (p2.pronargs != 1     OR NOT binary_coercible(p2.prorettype, p1.oprresult)     OR NOT binary_coercible(p1.oprleft, p2.proargtypes[0])     OR p1.oprright != 0);
SELECT p1.oid, p1.oprname, p2.oid, p2.pronameFROM pg_operator AS p1, pg_proc AS p2WHERE p1.oprcode = p2.oid AND    (p1.oprcanmerge OR p1.oprcanhash) AND    p2.provolatile = 'v';
SELECT p1.oid, p1.oprname, p2.oid, p2.pronameFROM pg_operator AS p1, pg_proc AS p2WHERE p1.oprrest = p2.oid AND    (p1.oprresult != 'bool'::regtype OR     p2.prorettype != 'float8'::regtype OR p2.proretset OR     p2.pronargs != 4 OR     p2.proargtypes[0] != 'internal'::regtype OR     p2.proargtypes[1] != 'oid'::regtype OR     p2.proargtypes[2] != 'internal'::regtype OR     p2.proargtypes[3] != 'int4'::regtype);
SELECT p1.oid, p1.oprname, p2.oid, p2.pronameFROM pg_operator AS p1, pg_proc AS p2WHERE p1.oprjoin = p2.oid AND    (p1.oprkind != 'b' OR p1.oprresult != 'bool'::regtype OR     p2.prorettype != 'float8'::regtype OR p2.proretset OR     p2.pronargs != 5 OR     p2.proargtypes[0] != 'internal'::regtype OR     p2.proargtypes[1] != 'oid'::regtype OR     p2.proargtypes[2] != 'internal'::regtype OR     p2.proargtypes[3] != 'int2'::regtype OR     p2.proargtypes[4] != 'internal'::regtype);
SELECT p1.oid, p1.oprnameFROM pg_operator as p1 LEFT JOIN pg_description as d     ON p1.tableoid = d.classoid and p1.oid = d.objoid and d.objsubid = 0WHERE d.classoid IS NULL AND p1.oid <= 9999;
WITH funcdescs AS (  SELECT p.oid as p_oid, proname, o.oid as o_oid,    pd.description as prodesc,    'implementation of ' || oprname || ' operator' as expecteddesc,    od.description as oprdesc  FROM pg_proc p JOIN pg_operator o ON oprcode = p.oid       LEFT JOIN pg_description pd ON         (pd.objoid = p.oid and pd.classoid = p.tableoid and pd.objsubid = 0)       LEFT JOIN pg_description od ON         (od.objoid = o.oid and od.classoid = o.tableoid and od.objsubid = 0)  WHERE o.oid <= 9999)SELECT * FROM funcdescs  WHERE prodesc IS DISTINCT FROM expecteddesc    AND oprdesc NOT LIKE 'deprecated%'    AND prodesc IS DISTINCT FROM oprdesc;
WITH funcdescs AS (  SELECT p.oid as p_oid, proname, o.oid as o_oid,    pd.description as prodesc,    'implementation of ' || oprname || ' operator' as expecteddesc,    od.description as oprdesc  FROM pg_proc p JOIN pg_operator o ON oprcode = p.oid       LEFT JOIN pg_description pd ON         (pd.objoid = p.oid and pd.classoid = p.tableoid and pd.objsubid = 0)       LEFT JOIN pg_description od ON         (od.objoid = o.oid and od.classoid = o.tableoid and od.objsubid = 0)  WHERE o.oid <= 9999)SELECT p_oid, proname, prodesc FROM funcdescs  WHERE prodesc IS DISTINCT FROM expecteddesc    AND oprdesc NOT LIKE 'deprecated%'ORDER BY 1;
SELECT o1.oid, o1.oprcode, o2.oid, o2.oprcodeFROM pg_operator AS o1, pg_operator AS o2, pg_proc AS p1, pg_proc AS p2WHERE o1.oprcom = o2.oid AND p1.oid = o1.oprcode AND p2.oid = o2.oprcode AND    (p1.provolatile != p2.provolatile OR     p1.proleakproof != p2.proleakproof);
SELECT o1.oid, o1.oprcode, o2.oid, o2.oprcodeFROM pg_operator AS o1, pg_operator AS o2, pg_proc AS p1, pg_proc AS p2WHERE o1.oprnegate = o2.oid AND p1.oid = o1.oprcode AND p2.oid = o2.oprcode AND    (p1.provolatile != p2.provolatile OR     p1.proleakproof != p2.proleakproof);
SELECT pp.oid::regprocedure as proc, pp.provolatile as vp, pp.proleakproof as lp,       po.oid::regprocedure as opr, po.provolatile as vo, po.proleakproof as loFROM pg_proc pp, pg_proc po, pg_operator o, pg_amproc ap, pg_amop aoWHERE pp.oid = ap.amproc AND po.oid = o.oprcode AND o.oid = ao.amopopr AND    ao.amopmethod = (SELECT oid FROM pg_am WHERE amname = 'btree') AND    ao.amopfamily = ap.amprocfamily AND    ao.amoplefttype = ap.amproclefttype AND    ao.amoprighttype = ap.amprocrighttype AND    ap.amprocnum = 1 AND    (pp.provolatile != po.provolatile OR     pp.proleakproof != po.proleakproof)ORDER BY 1;
SELECT ctid, aggfnoid::oidFROM pg_aggregate as p1WHERE aggfnoid = 0 OR aggtransfn = 0 OR    aggkind NOT IN ('n', 'o', 'h') OR    aggnumdirectargs < 0 OR    (aggkind = 'n' AND aggnumdirectargs > 0) OR    aggfinalmodify NOT IN ('r', 's', 'w') OR    aggmfinalmodify NOT IN ('r', 's', 'w') OR    aggtranstype = 0 OR aggtransspace < 0 OR aggmtransspace < 0;
SELECT a.aggfnoid::oid, p.pronameFROM pg_aggregate as a, pg_proc as pWHERE a.aggfnoid = p.oid AND    (p.prokind != 'a' OR p.proretset OR p.pronargs < a.aggnumdirectargs);
SELECT oid, pronameFROM pg_proc as pWHERE p.prokind = 'a' AND    NOT EXISTS (SELECT 1 FROM pg_aggregate a WHERE a.aggfnoid = p.oid);
SELECT a.aggfnoid::oid, p.pronameFROM pg_aggregate as a, pg_proc as pWHERE a.aggfnoid = p.oid AND    a.aggfinalfn = 0 AND p.prorettype != a.aggtranstype;
SELECT a.aggfnoid::oid, p.proname, ptr.oid, ptr.pronameFROM pg_aggregate AS a, pg_proc AS p, pg_proc AS ptrWHERE a.aggfnoid = p.oid AND    a.aggtransfn = ptr.oid AND    (ptr.proretset     OR NOT (ptr.pronargs =             CASE WHEN a.aggkind = 'n' THEN p.pronargs + 1             ELSE greatest(p.pronargs - a.aggnumdirectargs, 1) + 1 END)     OR NOT binary_coercible(ptr.prorettype, a.aggtranstype)     OR NOT binary_coercible(a.aggtranstype, ptr.proargtypes[0])     OR (p.pronargs > 0 AND         NOT binary_coercible(p.proargtypes[0], ptr.proargtypes[1]))     OR (p.pronargs > 1 AND         NOT binary_coercible(p.proargtypes[1], ptr.proargtypes[2]))     OR (p.pronargs > 2 AND         NOT binary_coercible(p.proargtypes[2], ptr.proargtypes[3]))          OR (p.pronargs > 3)    );
SELECT a.aggfnoid::oid, p.proname, pfn.oid, pfn.pronameFROM pg_aggregate AS a, pg_proc AS p, pg_proc AS pfnWHERE a.aggfnoid = p.oid AND    a.aggfinalfn = pfn.oid AND    (pfn.proretset OR     NOT binary_coercible(pfn.prorettype, p.prorettype) OR     NOT binary_coercible(a.aggtranstype, pfn.proargtypes[0]) OR     CASE WHEN a.aggfinalextra THEN pfn.pronargs != p.pronargs + 1          ELSE pfn.pronargs != a.aggnumdirectargs + 1 END     OR (pfn.pronargs > 1 AND         NOT binary_coercible(p.proargtypes[0], pfn.proargtypes[1]))     OR (pfn.pronargs > 2 AND         NOT binary_coercible(p.proargtypes[1], pfn.proargtypes[2]))     OR (pfn.pronargs > 3 AND         NOT binary_coercible(p.proargtypes[2], pfn.proargtypes[3]))          OR (pfn.pronargs > 4)    );
SELECT a.aggfnoid::oid, p.proname, ptr.oid, ptr.pronameFROM pg_aggregate AS a, pg_proc AS p, pg_proc AS ptrWHERE a.aggfnoid = p.oid AND    a.aggtransfn = ptr.oid AND ptr.proisstrict AND    a.agginitval IS NULL AND    NOT binary_coercible(p.proargtypes[0], a.aggtranstype);
SELECT ctid, aggfnoid::oidFROM pg_aggregate as p1WHERE aggmtranstype != 0 AND    (aggmtransfn = 0 OR aggminvtransfn = 0);
SELECT ctid, aggfnoid::oidFROM pg_aggregate as p1WHERE aggmtranstype = 0 AND    (aggmtransfn != 0 OR aggminvtransfn != 0 OR aggmfinalfn != 0 OR     aggmtransspace != 0 OR aggminitval IS NOT NULL);
SELECT a.aggfnoid::oid, p.pronameFROM pg_aggregate as a, pg_proc as pWHERE a.aggfnoid = p.oid AND    a.aggmtransfn != 0 AND    a.aggmfinalfn = 0 AND p.prorettype != a.aggmtranstype;
SELECT a.aggfnoid::oid, p.proname, ptr.oid, ptr.pronameFROM pg_aggregate AS a, pg_proc AS p, pg_proc AS ptrWHERE a.aggfnoid = p.oid AND    a.aggmtransfn = ptr.oid AND    (ptr.proretset     OR NOT (ptr.pronargs =             CASE WHEN a.aggkind = 'n' THEN p.pronargs + 1             ELSE greatest(p.pronargs - a.aggnumdirectargs, 1) + 1 END)     OR NOT binary_coercible(ptr.prorettype, a.aggmtranstype)     OR NOT binary_coercible(a.aggmtranstype, ptr.proargtypes[0])     OR (p.pronargs > 0 AND         NOT binary_coercible(p.proargtypes[0], ptr.proargtypes[1]))     OR (p.pronargs > 1 AND         NOT binary_coercible(p.proargtypes[1], ptr.proargtypes[2]))     OR (p.pronargs > 2 AND         NOT binary_coercible(p.proargtypes[2], ptr.proargtypes[3]))          OR (p.pronargs > 3)    );
SELECT a.aggfnoid::oid, p.proname, ptr.oid, ptr.pronameFROM pg_aggregate AS a, pg_proc AS p, pg_proc AS ptrWHERE a.aggfnoid = p.oid AND    a.aggminvtransfn = ptr.oid AND    (ptr.proretset     OR NOT (ptr.pronargs =             CASE WHEN a.aggkind = 'n' THEN p.pronargs + 1             ELSE greatest(p.pronargs - a.aggnumdirectargs, 1) + 1 END)     OR NOT binary_coercible(ptr.prorettype, a.aggmtranstype)     OR NOT binary_coercible(a.aggmtranstype, ptr.proargtypes[0])     OR (p.pronargs > 0 AND         NOT binary_coercible(p.proargtypes[0], ptr.proargtypes[1]))     OR (p.pronargs > 1 AND         NOT binary_coercible(p.proargtypes[1], ptr.proargtypes[2]))     OR (p.pronargs > 2 AND         NOT binary_coercible(p.proargtypes[2], ptr.proargtypes[3]))          OR (p.pronargs > 3)    );
SELECT a.aggfnoid::oid, p.proname, pfn.oid, pfn.pronameFROM pg_aggregate AS a, pg_proc AS p, pg_proc AS pfnWHERE a.aggfnoid = p.oid AND    a.aggmfinalfn = pfn.oid AND    (pfn.proretset OR     NOT binary_coercible(pfn.prorettype, p.prorettype) OR     NOT binary_coercible(a.aggmtranstype, pfn.proargtypes[0]) OR     CASE WHEN a.aggmfinalextra THEN pfn.pronargs != p.pronargs + 1          ELSE pfn.pronargs != a.aggnumdirectargs + 1 END     OR (pfn.pronargs > 1 AND         NOT binary_coercible(p.proargtypes[0], pfn.proargtypes[1]))     OR (pfn.pronargs > 2 AND         NOT binary_coercible(p.proargtypes[1], pfn.proargtypes[2]))     OR (pfn.pronargs > 3 AND         NOT binary_coercible(p.proargtypes[2], pfn.proargtypes[3]))          OR (pfn.pronargs > 4)    );
SELECT a.aggfnoid::oid, p.proname, ptr.oid, ptr.pronameFROM pg_aggregate AS a, pg_proc AS p, pg_proc AS ptrWHERE a.aggfnoid = p.oid AND    a.aggmtransfn = ptr.oid AND ptr.proisstrict AND    a.aggminitval IS NULL AND    NOT binary_coercible(p.proargtypes[0], a.aggmtranstype);
SELECT a.aggfnoid::oid, p.proname, ptr.oid, ptr.proname, iptr.oid, iptr.pronameFROM pg_aggregate AS a, pg_proc AS p, pg_proc AS ptr, pg_proc AS iptrWHERE a.aggfnoid = p.oid AND    a.aggmtransfn = ptr.oid AND    a.aggminvtransfn = iptr.oid AND    ptr.proisstrict != iptr.proisstrict;
SELECT a.aggfnoid, p.pronameFROM pg_aggregate as a, pg_proc as pWHERE a.aggcombinefn = p.oid AND    (p.pronargs != 2 OR     p.prorettype != p.proargtypes[0] OR     p.prorettype != p.proargtypes[1] OR     NOT binary_coercible(a.aggtranstype, p.proargtypes[0]));
SELECT a.aggfnoid, p.pronameFROM pg_aggregate as a, pg_proc as pWHERE a.aggcombinefn = p.oid AND    a.aggtranstype = 'internal'::regtype AND p.proisstrict;
SELECT aggfnoid, aggtranstype, aggserialfn, aggdeserialfnFROM pg_aggregateWHERE (aggserialfn != 0 OR aggdeserialfn != 0)  AND (aggtranstype != 'internal'::regtype OR aggcombinefn = 0 OR       aggserialfn = 0 OR aggdeserialfn = 0);
SELECT a.aggfnoid, p.pronameFROM pg_aggregate as a, pg_proc as pWHERE a.aggserialfn = p.oid AND    (p.prorettype != 'bytea'::regtype OR p.pronargs != 1 OR     p.proargtypes[0] != 'internal'::regtype OR     NOT p.proisstrict);
SELECT a.aggfnoid, p.pronameFROM pg_aggregate as a, pg_proc as pWHERE a.aggdeserialfn = p.oid AND    (p.prorettype != 'internal'::regtype OR p.pronargs != 2 OR     p.proargtypes[0] != 'bytea'::regtype OR     p.proargtypes[1] != 'internal'::regtype OR     NOT p.proisstrict);
SELECT a.aggfnoid, a.aggcombinefn, a.aggserialfn, a.aggdeserialfn,       b.aggfnoid, b.aggcombinefn, b.aggserialfn, b.aggdeserialfnFROM    pg_aggregate a, pg_aggregate bWHERE    a.aggfnoid < b.aggfnoid AND a.aggtransfn = b.aggtransfn AND    (a.aggcombinefn != b.aggcombinefn OR a.aggserialfn != b.aggserialfn     OR a.aggdeserialfn != b.aggdeserialfn);
SELECT DISTINCT proname, oprnameFROM pg_operator AS o, pg_aggregate AS a, pg_proc AS pWHERE a.aggfnoid = p.oid AND a.aggsortop = o.oidORDER BY 1, 2;
SELECT a.aggfnoid::oid, o.oidFROM pg_operator AS o, pg_aggregate AS a, pg_proc AS pWHERE a.aggfnoid = p.oid AND a.aggsortop = o.oid AND    (oprkind != 'b' OR oprresult != 'boolean'::regtype     OR oprleft != p.proargtypes[0] OR oprright != p.proargtypes[0]);
SELECT a.aggfnoid::oid, o.oidFROM pg_operator AS o, pg_aggregate AS a, pg_proc AS pWHERE a.aggfnoid = p.oid AND a.aggsortop = o.oid AND    NOT EXISTS(SELECT 1 FROM pg_amop               WHERE amopmethod = (SELECT oid FROM pg_am WHERE amname = 'btree')                     AND amopopr = o.oid                     AND amoplefttype = o.oprleft                     AND amoprighttype = o.oprright);
SELECT DISTINCT proname, oprname, amopstrategyFROM pg_operator AS o, pg_aggregate AS a, pg_proc AS p,     pg_amop as aoWHERE a.aggfnoid = p.oid AND a.aggsortop = o.oid AND    amopopr = o.oid AND    amopmethod = (SELECT oid FROM pg_am WHERE amname = 'btree')ORDER BY 1, 2;
SELECT p1.oid::regprocedure, p2.oid::regprocedureFROM pg_proc AS p1, pg_proc AS p2WHERE p1.oid < p2.oid AND p1.proname = p2.proname AND    p1.prokind = 'a' AND p2.prokind = 'a' AND    array_dims(p1.proargtypes) != array_dims(p2.proargtypes)ORDER BY 1;
SELECT oid, pronameFROM pg_proc AS pWHERE prokind = 'a' AND proargdefaults IS NOT NULL;
SELECT p.oid, pronameFROM pg_proc AS p JOIN pg_aggregate AS a ON a.aggfnoid = p.oidWHERE prokind = 'a' AND provariadic != 0 AND a.aggkind = 'n';
SELECT p1.oidFROM pg_opfamily as p1WHERE p1.opfmethod = 0 OR p1.opfnamespace = 0;
SELECT oid, opfname FROM pg_opfamily fWHERE NOT EXISTS (SELECT 1 FROM pg_opclass WHERE opcfamily = f.oid);
SELECT p1.oidFROM pg_opclass AS p1WHERE p1.opcmethod = 0 OR p1.opcnamespace = 0 OR p1.opcfamily = 0    OR p1.opcintype = 0;
SELECT p1.oid, p2.oidFROM pg_opclass AS p1, pg_opfamily AS p2WHERE p1.opcfamily = p2.oid AND p1.opcmethod != p2.opfmethod;
SELECT p1.oid, p2.oidFROM pg_opclass AS p1, pg_opclass AS p2WHERE p1.oid != p2.oid AND    p1.opcmethod = p2.opcmethod AND p1.opcintype = p2.opcintype AND    p1.opcdefault AND p2.opcdefault;
SELECT oid, opcname FROM pg_opclass WHERE NOT amvalidate(oid);
SELECT p1.oid, p1.amnameFROM pg_am AS p1WHERE p1.amhandler = 0;
SELECT p1.oid, p1.amname, p2.oid, p2.pronameFROM pg_am AS p1, pg_proc AS p2WHERE p2.oid = p1.amhandler AND p1.amtype = 'i' AND    (p2.prorettype != 'index_am_handler'::regtype     OR p2.proretset     OR p2.pronargs != 1     OR p2.proargtypes[0] != 'internal'::regtype);
SELECT p1.oid, p1.amname, p2.oid, p2.pronameFROM pg_am AS p1, pg_proc AS p2WHERE p2.oid = p1.amhandler AND p1.amtype = 's' AND    (p2.prorettype != 'table_am_handler'::regtype     OR p2.proretset     OR p2.pronargs != 1     OR p2.proargtypes[0] != 'internal'::regtype);
SELECT p1.amopfamily, p1.amopstrategyFROM pg_amop as p1WHERE p1.amopfamily = 0 OR p1.amoplefttype = 0 OR p1.amoprighttype = 0    OR p1.amopopr = 0 OR p1.amopmethod = 0 OR p1.amopstrategy < 1;
SELECT p1.amopfamily, p1.amopstrategyFROM pg_amop as p1WHERE NOT ((p1.amoppurpose = 's' AND p1.amopsortfamily = 0) OR           (p1.amoppurpose = 'o' AND p1.amopsortfamily <> 0));
SELECT p1.oid, p2.oidFROM pg_amop AS p1, pg_opfamily AS p2WHERE p1.amopfamily = p2.oid AND p1.amopmethod != p2.opfmethod;
SELECT DISTINCT amopmethod, amopstrategy, oprnameFROM pg_amop p1 LEFT JOIN pg_operator p2 ON amopopr = p2.oidORDER BY 1, 2, 3;
SELECT p1.amopfamily, p1.amopopr, p2.oid, p2.oprnameFROM pg_amop AS p1, pg_operator AS p2WHERE p1.amopopr = p2.oid AND p1.amoppurpose = 's' AND    (p2.oprrest = 0 OR p2.oprjoin = 0);
SELECT p1.opcname, p1.opcfamilyFROM pg_opclass AS p1WHERE NOT EXISTS(SELECT 1 FROM pg_amop AS p2                 WHERE p2.amopfamily = p1.opcfamily                   AND binary_coercible(p1.opcintype, p2.amoplefttype));
SELECT p1.amopfamily, p1.amopstrategy, p1.amopoprFROM pg_amop AS p1WHERE NOT EXISTS(SELECT 1 FROM pg_opclass AS p2                 WHERE p2.opcfamily = p1.amopfamily                   AND binary_coercible(p2.opcintype, p1.amoplefttype));
SELECT p1.amopfamily, p1.amopopr, p2.oprname, p3.prosrcFROM pg_amop AS p1, pg_operator AS p2, pg_proc AS p3WHERE p1.amopopr = p2.oid AND p2.oprcode = p3.oid AND    p1.amoplefttype = p1.amoprighttype AND    p3.provolatile != 'i';
SELECT p1.amopfamily, p1.amopopr, p2.oprname, p3.prosrcFROM pg_amop AS p1, pg_operator AS p2, pg_proc AS p3WHERE p1.amopopr = p2.oid AND p2.oprcode = p3.oid AND    p1.amoplefttype != p1.amoprighttype AND    p3.provolatile = 'v';
SELECT p1.amprocfamily, p1.amprocnumFROM pg_amproc as p1WHERE p1.amprocfamily = 0 OR p1.amproclefttype = 0 OR p1.amprocrighttype = 0    OR p1.amprocnum < 0 OR p1.amproc = 0;
SELECT p1.amprocfamily, p1.amproc, p2.prosrcFROM pg_amproc AS p1, pg_proc AS p2WHERE p1.amproc = p2.oid AND    p1.amproclefttype = p1.amprocrighttype AND    p2.provolatile != 'i';
SELECT p1.amprocfamily, p1.amproc, p2.prosrcFROM pg_amproc AS p1, pg_proc AS p2WHERE p1.amproc = p2.oid AND    p1.amproclefttype != p1.amprocrighttype AND    p2.provolatile = 'v';
SELECT amp.amproc::regproc AS proc, opf.opfname AS opfamily_name,       opc.opcname AS opclass_name, opc.opcintype::regtype AS opcintypeFROM pg_am AS amJOIN pg_opclass AS opc ON opc.opcmethod = am.oidJOIN pg_opfamily AS opf ON opc.opcfamily = opf.oidLEFT JOIN pg_amproc AS amp ON amp.amprocfamily = opf.oid AND    amp.amproclefttype = opc.opcintype AND amp.amprocnum = 4WHERE am.amname = 'btree' AND    amp.amproc IS DISTINCT FROM 'btequalimage'::regprocORDER BY 1, 2, 3;
SELECT p1.indexrelid, p1.indrelidFROM pg_index as p1WHERE p1.indexrelid = 0 OR p1.indrelid = 0 OR      p1.indnatts <= 0 OR p1.indnatts > 32;
SELECT p1.indexrelid, p1.indrelidFROM pg_index as p1WHERE array_lower(indkey, 1) != 0 OR array_upper(indkey, 1) != indnatts-1 OR    array_lower(indclass, 1) != 0 OR array_upper(indclass, 1) != indnatts-1 OR    array_lower(indcollation, 1) != 0 OR array_upper(indcollation, 1) != indnatts-1 OR    array_lower(indoption, 1) != 0 OR array_upper(indoption, 1) != indnatts-1;
SELECT indexrelid::regclass, indrelid::regclass, attname, atttypid::regtype, opcnameFROM (SELECT indexrelid, indrelid, unnest(indkey) as ikey,             unnest(indclass) as iclass, unnest(indcollation) as icoll      FROM pg_index) ss,      pg_attribute a,      pg_opclass opcWHERE a.attrelid = indrelid AND a.attnum = ikey AND opc.oid = iclass AND      (NOT binary_coercible(atttypid, opcintype) OR icoll != attcollation);
SELECT indexrelid::regclass, indrelid::regclass, attname, atttypid::regtype, opcnameFROM (SELECT indexrelid, indrelid, unnest(indkey) as ikey,             unnest(indclass) as iclass, unnest(indcollation) as icoll      FROM pg_index      WHERE indrelid < 16384) ss,      pg_attribute a,      pg_opclass opcWHERE a.attrelid = indrelid AND a.attnum = ikey AND opc.oid = iclass AND      (opcintype != atttypid OR icoll != attcollation)ORDER BY 1;
SELECT relname, attname, attcollationFROM pg_class c, pg_attribute aWHERE c.oid = attrelid AND c.oid < 16384 AND    c.relkind != 'v' AND      attcollation != 0 AND    attcollation != (SELECT oid FROM pg_collation WHERE collname = 'C');
SELECT indexrelid::regclass, indrelid::regclass, iclass, icollFROM (SELECT indexrelid, indrelid,             unnest(indclass) as iclass, unnest(indcollation) as icoll      FROM pg_index      WHERE indrelid < 16384) ssWHERE icoll != 0 AND    icoll != (SELECT oid FROM pg_collation WHERE collname = 'C');
